﻿#region Imports
using System;
using System.Linq;
using CommonUtilities.Attributes;
using CommonUtilities.Enums;
using CommonUtilities.Extensions;
#endregion

namespace OneStopProgrammingMatrix.Models
{
    [Serializable]
    public class MatrixItem : MatrixGroupInfo
    {
        #region Properties
        [Constraint(eConstraint.Automatic)]
        public Guid? PKey { get; set; }

        [Constraint(eConstraint.Required)]
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; RaisePropertyChanged("Name"); }
        }

        private string path;
        [Constraint(eConstraint.Required)]
        public string Path
        {
            get { return path; }
            set { path = value; RaisePropertyChanged("Path"); }
        }

        [Constraint(eConstraint.Recommended)]
        public object Icon { get; set; }

        [Constraint(eConstraint.Recommended)]
        public int Sort { get; set; }

        [Constraint(eConstraint.Recommended)]
        public string Description { get; set; }

        [Constraint(eConstraint.Automatic)]
        public DateTime UpdatedOn { get; set; }
        #endregion

        #region Constructors
        public MatrixItem()
            : base()
        {
            PKey = new Guid(DateTime.Now.ToString("yyyyMMddHHmmssff").ToCharArray()._Select(ch => (byte)ch).ToArray());
            UpdatedOn = new DateTime(DateTime.Now.Ticks, DateTimeKind.Unspecified);
        }
        #endregion
    }
}
